package io.datajek.spring.basics.movierecommendersystem.partone.nine;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class RecommenderImplementation {

    @Autowired
    @Qualifier("CF")
    //使用过滤器接口选择过滤器
    public Filter filter;

    //构造函数注入
    public RecommenderImplementation(@Qualifier("collaborativeFilter") Filter filter){
        super();
        this.filter=filter;
        System.out.println("Constructor invoked...");
    }

        public String[] recommendMovies (String movie){


            System.out.println("\nName of the filter in use:"+filter+"\n");
            //使用基于内容的过滤表来寻找类似的电影

            //ContentBasedFilter contentBasedFilter = new ContentBasedFilter();
            String[] results = filter.getRecommendations("Finding Dory");

            //返回结果
            // return new String{"M1","M2","M3"};
            return results;

        }
}

